package cn.ac.iscas.domain.job;

import cn.ac.iscas.service.sql.FlinkSqlService;
import cn.ac.iscas.service.sql.dameng.DamengSqlService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;


@Component
public class JobExecutorFactory {
    @Autowired
    FlinkSqlService flinkSqlService;

    @Autowired
    DamengSqlService damengSqlService;
    //JobExecutorInterface createExecutor();

    public JobExecutorInterface createExecutor(JobType jobType) {
        switch (jobType) {
            case FLINK:
                return flinkSqlService;
            case DAMENG:
                return damengSqlService;
            default:
                throw new IllegalArgumentException("不支持该类型任务，当前支持Flink任务和达梦任务。");
        }
    }
}
